﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace WindowsFormsApplication1
{
    public partial class add_individual : Form
    {
        SqlConnection cn = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=E:\elkolyaa\software 2\Calender_final version\calendar-maintainer\calendar\WindowsFormsApplication1\WindowsFormsApplication1\usersDB.mdf;Integrated Security=True");
        SqlCommand cmd = new SqlCommand();

        private class Item
        {
            public string Name;
            public int Value;
            public Item(string name, int value)
            {
                Name = name; Value = value;
            }
            public override string ToString()
            {
                // Generates the text shown in the combo box
                return Name;
            }
        }
        public add_individual()
        {
            InitializeComponent();
            for (int x = 2; x <= 25; x++)
            {
                cb1.Items.Add(x - 1);
                cb2.Items.Add(x - 1);
            }

        }
        private void button1_Click(object sender, EventArgs e)
        {

            individual_clas MyObject = new individual_clas();


            object from1 = cb1.SelectedItem;
            MyObject.u.from = Convert.ToInt32(from1);
            object to1 = cb2.SelectedItem;
            MyObject.u.to = Convert.ToInt32(to1);
            MyObject.u.descrip = desc.Text;
            MyObject.u.dayy = label5.Text;
            MyObject.u.numday = label4.Text;

            MyObject.u.num = int.Parse(MyObject.u.numday);

            MyObject.u.Month = label6.Text;
            MyObject.u.yearr = label7.Text;

            MyObject.Add_individual(MyObject.u.descrip,MyObject.u.from,MyObject.u.to,MyObject.u.dayy,MyObject.u.num,MyObject.u.Month,MyObject.u.yearr);
            calendar cal = new calendar();
            bool check = false;
        }

        private void add_individual_Load(object sender, EventArgs e)
        {
            cmd.Connection = cn;
        }

        private void combday_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void label6_Click(object sender, EventArgs e)
        {

        }

        private void label4_Click(object sender, EventArgs e)
        {

        }

        private void label6_Click_1(object sender, EventArgs e)
        {

        }

        private void label5_Click(object sender, EventArgs e)
        {

        }

        private void label7_Click(object sender, EventArgs e)
        {

        }
    }
}
